package com.xique.job.task;

import com.xique.park.api.RemoteIndexService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 首页统计定时任务
 *
 * @author WLD
 */
@Slf4j
@RequiredArgsConstructor
@Component
public class IndexTask {

    private final RemoteIndexService remoteIndexService;

    /**
     * 更新首页统计缓存
     */
    public void updateStatisticsCache() {
        log.info("[定时任务]-更新首页统计缓存");
        long startTime = System.currentTimeMillis();
        remoteIndexService.updateStatisticsCache();
        log.info("[定时任务]-更新首页统计缓存执行时间：{}", System.currentTimeMillis() - startTime);
    }

}
